package com.sweets.look.ui.browser;

import android.app.Activity;
import android.webkit.DownloadListener;
import android.webkit.URLUtil;
import com.sweets.look.util.BrowserUtils;

public class LightningDownloadListener implements DownloadListener {
    private final Activity mActivity;

    public LightningDownloadListener(Activity activity) {
        super();
        this.mActivity = activity;
    }

    public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype,
                                long contentLength) {
        BrowserUtils.downloadFile(this.mActivity, url, userAgent, contentDisposition, mimetype, false,
                URLUtil.guessFileName(url, contentDisposition, mimetype), true);
    }
}

